package com.qingmeng.applyjob.portal.controller;

import com.qingmeng.applyjob.common.api.CommonResult;
import com.qingmeng.applyjob.portal.model.dto.ImproveResumeParam;
import com.qingmeng.applyjob.portal.model.dto.ImproveResumeParamOUT;
import com.qingmeng.applyjob.portal.model.vo.ResumeVo;
import com.qingmeng.applyjob.portal.service.ResumeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "resumeController" , description = "完善简历接口")
@RestController
@RequestMapping("/resume")
public class ResumeController {
    @Autowired
    private ResumeService resumeService;

    @ApiOperation("完善简历")
    @PostMapping("/improveResume")
    private CommonResult<Integer> improveResume(@ApiParam("完善简历时需要填写的信息") @RequestBody ImproveResumeParam improveResumeParam){
        int result = resumeService.improveResume(improveResumeParam);
        if(result > 0){
            return CommonResult.success(result,"完善简历成功");
        }
        return CommonResult.failed("完善简历失败");
    }

    @ApiOperation("获取我的简历信息")
    @GetMapping("/getMyResume")
    private CommonResult<ResumeVo> getMyResume(){
        ResumeVo myResume = resumeService.getMyResume();
        if (myResume != null){
            return CommonResult.success(myResume,"获取简历成功");
        }
        return CommonResult.failed("未查询到相关信息");
    }
}
